package com.cn.wanxi.servlet;

import com.cn.wanxi.service.ICompanyService;
import com.cn.wanxi.service.INavService;
import com.cn.wanxi.service.impl.CompanyServiceImpl;
import com.cn.wanxi.service.impl.NavServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/home")
public class HomeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        ICompanyService service=new CompanyServiceImpl();
//        req.setAttribute("companyModel", service.getCompanyModel());

        INavService navService=new NavServiceImpl();
        req.setAttribute("navList", navService.getNavList());//key-value的形式
//
////        得到新闻数据
//        NewsService newsService=new NewsService();
//        req.setAttribute("newsList", newsService.getList());
//
//        //得到产品信息
//        ProductService productService=new ProductService();
//        req.setAttribute("productList", productService.getList());
        req.getRequestDispatcher("/jsp/home.jsp").forward(req, resp);
    }
}
